<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="hmg.common.ValueHolder"%>
<%@ page import="hmg.vo.BoardVO" %>
<%
    String filePath = request.getParameter("filePath");
    String title = request.getParameter("title");

    String browser = request.getHeader("User-Agent");
%>
<script type="text/javascript" src="/hmg/js/web/kor/com/googleAnalytics.js"></script>
                <div class="photo_mask"></div>
                <div class="photo_layPop">
                    <p class="btnClose"><img src="/hmg/images/web/kor/mgr/gallery_Slide_Close.png" alt="닫기"/></p>

                    <div class="vodViewWrap">
                        <div class="vodContainer">
<%  if (browser.indexOf("Mobile") <= 0 && browser.indexOf("Android") <= 0) { %>
                            <div id="loading"><img src="/hmg/images/web/kor/common/loading.gif" alt="loading중" /></div>
                            <object align="middle" width="640px" height="360px" id="topNavi" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
                                <param value="/hmg/swf/web/kor/hmg_player_Local.swf?serverPath=<%= ValueHolder.VOD_SERVER_DOMAIN %>&filePath=mp4:<%= filePath %>&titleStr=&bodyStr=<%= title %>" name="movie" />
                                <param value="high" name="quality" />
                                <param value="true" name="allowFullScreen" />
                                <param value="sameDomain" name="allowScriptAccess" />
                                <param value="transparent" name="wmode" />
                                <param value="transparent" name="bgcolor" />
                                <embed align="middle" width="640px" height="360px" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" wmode="transparent" allowFullScreen="true" quality="high" src="/hmg/swf/web/kor/hmg_player_Local.swf?serverPath=<%= ValueHolder.VOD_SERVER_DOMAIN %>&filePath=mp4:<%= filePath %>&titleStr=&bodyStr=<%= title %>"></embed>
                            </object>

                            <!--non flash -->
                            <p class="alterText" style="display:none;"><img src="/hmg/images/web/kor/common/non-flash.jpg" alt="Sorry, Flash Version - 동영상을 재생하시려면 Adobe Flash Player 10 이상이 설치되어 있어야 합니다." /></p>

<%
    }
    else {
        if (browser.indexOf("iPhone") > 0 || browser.indexOf("iPad") > 0) {
%>
                            <div class="tablet-vod">
                                <video id="video" width="640px" height="360px" autobuffer controls onclick="this.play();">
                                    <source src="<%= ValueHolder.IPHONE_VOD_SERVER_DOMAIN %><%= filePath %>/playlist.m3u8" />
                                    <a href="<%= ValueHolder.IPHONE_VOD_SERVER_DOMAIN %><%= filePath %>/playlist.m3u8" style="width:640px;height:360px;text-align:center;display:inline-block;">
                                    <img src="/hmg/images/web/kor/gbc/non-flash-img02.jpg" alt="Please press the play button. 동영상을 감상하시려면 재생버튼을 눌러주세요."/></a>
                                </video>
<%
        }
        else {
%>
                            <!--tablet-->
                            <div class="tablet-vod" style='background:url(/hmg/images/web/kor/gbc/non-flash-img02.jpg) no-repeat;background-size:640px;'>
                                <video id="video" poster="/hmg/images/web/kor/gbc/non-flash-img02.jpg" style="width:640px;height:360px;" autobuffer controls onclick="this.play();">
                                    <source src="<%= ValueHolder.ANDROID_VOD_SERVER_DOMAIN %><%= filePath %>" />
                                    <a href="<%= ValueHolder.ANDROID_VOD_SERVER_DOMAIN %><%= filePath %>" style="width:640px;height:360px;text-align:center;display:inline-block;">
                                    <img src="/hmg/images/web/kor/gbc/non-flash-img02.jpg" alt="Please press the play button. 동영상을 감상하시려면 재생버튼을 눌러주세요."/></a>
                                </video>
<%      } %>
                            </div>
                            <!--//tablet-->
<%  } %>
                        </div>
                    </div>
                </div>
<script type="text/javascript">
$(document).ready(function(){
    var ind = "0";
    var mobileKeyWords = new Array("iPhone", "iPad", "BlackBerry", "Android", "Windows CE", "LG", "MOT", "SAMSUNG", "SonyEricsson");
    for (var word in mobileKeyWords){
        if (navigator.userAgent.match(mobileKeyWords[word]) != null){
            //mobile
            $("#topNavi").remove();
            $("#tablet-broadcastView").show();
            $(".alterText").remove();
            $(this).find(".photo_layOver").css("display","block").animate({"top":"118px","opacity": ".8" });
            $(this).find(".bg").hide();
            var ind = "1";

            $(".photo_layOpen").click(function(){
                $("#loading").hide();
            });
            // 레이어 창 닫으면 영상 멈추기
            $(".btnClose > img").click(function () {
                $(".tablet-vod").remove();
            });
            return false;
        } else if (navigator.userAgent.match(mobileKeyWords[word]) == null)     {
            //web
            // 레이어 창 닫으면 영상 멈추기
            $(".btnClose > img").click(function () {
                $(".vodContainer object").remove();
            });
            $(this).find(".photo_layOver").css("display","none").animate({"top":"162px","opacity": "1"}).stop(true, true);
            $(this).find(".bg").show();
        }
    }
});

function fn_copy_url() {
    window.clipboardData.setData("Text", "<%= ValueHolder.VOD_SERVER_DOMAIN %><%= filePath %>");
    alert("주소가 클립보드에 복사되었습니다.");
}

function fn_copy_html() {
    var html =
        "    <object align=\"middle\" width=\"640px\" height=\"360px\" id=\"topNavi\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\">\n" +
        "    <param value=\"<%= ValueHolder.SERVER_DOMAIN %>/hmg/swf/web/kor/hmg_player_Local.swf?serverPath=<%= ValueHolder.VOD_SERVER_DOMAIN %>&filePath=mp4:<%= filePath %>&titleStr=&bodyStr=<%= title %>\" name=\"movie\" />\n" +
        "    <param value=\"high\" name=\"quality\" />\n" +
        "    <param value=\"sameDomain\" name=\"allowScriptAccess\" />\n" +
        "    <param value=\"transparent\" name=\"wmode\" />\n" +
        "    <param value=\"transparent\" name=\"bgcolor\" />\n" +
        "    <embed align=\"middle\" width=\"640px\" height=\"360px\" pluginspage=\"https://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"sameDomain\" wmode=\"transparent\" quality=\"high\" src=\"<%= ValueHolder.SERVER_DOMAIN %>/hmg/swf/hmg_player_Local.swf?serverPath=<%= ValueHolder.VOD_SERVER_DOMAIN %>&filePath=mp4:<%= filePath %>&titleStr=&bodyStr=<%= title %>\"></embed></object>\n";

    window.clipboardData.setData("Text", html);
    alert("HTML이 클립보드에 복사되었습니다.");
}
</script>